<!DOCTYPE html>
<html>
<head th:include="fragments/header :: header">
<meta charset="utf-8" />
</head>
<body>
	<input type="button" value="拆红包" onclick="test()">
	<input id="butt" th:value="${openid}" type="hidden">
</body>
<script type="text/javascript">
	$(function() {
		if (!isWeiXin()) {
			window.location.href = "../403.html";
			alert("请使用微信浏览器打开！");
		}
	});
	function isWeiXin() {
		var ua = window.navigator.userAgent.toLowerCase();
		if (ua.match(/MicroMessenger/i) == 'micromessenger') {
			return true;
		} else {
			return false;
		}
	}
	function test() {
		$.ajax({
			type : "POST",
			url : '/api/weiXinRedPack/' + $("#butt").val(),
			error : function(request) {
				layer.alert("系统错误");
			},
			success : function(result) {
				if (result.status == 0) {
					alert("红包已发，请到公众号领取");
				} else {
					sessionCheckTimeOut(result);
				}
			}
		});
	}
</script>
</html>